package com.atguigu.spzx.service.exception;

import com.atguigu.spzx.model.vo.common.ResultCodeEnum;
import lombok.Data;

/**
 * @author MikeCoder
 * @create 2023-12-0210:26
 * @description:
 * @verson:
 */
@Data
public class GuiguException extends RuntimeException{
    private Integer code;//错误状态码
    private String message;//错误信息

    private ResultCodeEnum resultCodeEnum;//封装错误状态和错误信息

    public GuiguException(ResultCodeEnum resultCodeEnum){
        this.resultCodeEnum = resultCodeEnum;
        this.code = resultCodeEnum.getCode();
        this.message = resultCodeEnum.getMessage();
    }

    public GuiguException(Integer code,String message){
        this.code = code;
        this.message = message;
    }
}
